<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>   
function Person(){
}
var person = new Person()
//console.log(person)//{__proto__}
//console.log(Person.prototype)//{cons:...,__proto__}
 
Grand.prototype.lastname = '李'
 function Grand(){
//this.lastname='李'
 }
var grand = new Grand()
//----------------------------------------

Father.prototype = grand
 function Father(){
this.name = '小花'
this.fortune = {
    card1:'visa'
}
this.num = 100
 }
 var father = new Father()

//------------------------------------------
 Son.prototype = father //让Son的原型指向Father
 function Son(){
this.hobbit = '读书'
 }
 var son = new Son()

//  console.log(son.hobbit);//读书
//  console.log(son.name);//小花
//  console.log(son.lastname)//李
 
//console.log(son.fortune)//{ card1:'visa'}

son.fortune.card2 = 'master'
console.log(son)//{hobbit:'读书'}
console.log(father.fortune)//{card1: 'visa', card2: 'master'} 引用值修改
 
son.name = '小白'//子对象无法修改到父对象的属性，子对象就会新添一个属性name,覆盖了继承过来的name，该现象叫屏蔽
console.log(father.name)//小花
console.log(son.name)//小白 

son.num++
console.log(son.num)//101
 </script>
</html>